import request from '@/utils/request'

// 查询库存分配列表
export function listAllocation(query) {
  return request({
    url: '/wms/allocation/list',
    method: 'get',
    params: query
  })
}

// 查询库存分配详情
export function getAllocation(id) {
  return request({
    url: '/wms/allocation/' + id,
    method: 'get'
  })
}

// 执行库存分配
export function executeAllocation(outboundOrderId, strategy) {
  return request({
    url: '/wms/allocation/execute',
    method: 'post',
    params: { outboundOrderId, strategy }
  })
}

// 取消库存分配
export function cancelAllocation(id, reason) {
  return request({
    url: '/wms/allocation/cancel/' + id,
    method: 'put',
    params: { reason }
  })
}

// 删除库存分配
export function delAllocation(id) {
  return request({
    url: '/wms/allocation/' + id,
    method: 'delete'
  })
}
